package com.bdq.interaction.application.service;

import com.bdq.common.entity.common.CommonResult;
import com.bdq.common.exception.ServerException;
import com.bdq.common.feign.user.UserFeign;
import com.bdq.common.feign.user.vo.UserListVO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author malei
 * @date 2024-05-23 18:26
 */
@Component
public class MyFeignClient {

    @Resource
    private UserFeign userFeign;

    public List<UserListVO> listUser(List<Long> userIds) {
        CommonResult<List<UserListVO>> result = userFeign.listUser(userIds);
        if (result.isError()) {
            throw new ServerException("[用户服务异常]异常信息:".concat(result.getMsg()));
        }
        return result.getData();
    }
}
